package com.second.app.thread.volatiled;

/**
 * @Author GYZ
 * <pre>
 *
 * </pre>
 */
public class PrintString implements Runnable {

    private boolean isContinuePrint = true;

    public boolean isContinuePrint() {
        return isContinuePrint;
    }

    public void setContinuePrint(boolean isContinuePrint) {
        this.isContinuePrint = isContinuePrint;
    }


    public void printMethod() {
        try {
            while (isContinuePrint) {
                System.out.println("线程：" + Thread.currentThread().getName());
                Thread.sleep(1000);
            }
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }


    @Override
    public void run() {
        printMethod();
    }
}
